Skip to content

Conversation

@micahgodbolt
Copy link
Member

Moving the removal of badge's aria-hidden into it's own PR rather than being a part of #22775

@codesandbox-ci
Copy link

codesandbox-ci bot commented May 5, 2022

This pull request is automatically built and testable in CodeSandbox.

To see build info of the built libraries, click here or the icon next to each commit SHA.

Latest deployment of this branch, based on commit 6e1e995:

Sandbox Source
@fluentui/react 8 starter Configuration
@fluentui/react-components 9 starter Configuration

@fabricteam
Copy link
Collaborator

fabricteam commented May 5, 2022

📊 Bundle size report

Package & Exports Baseline (minified/GZIP) PR Change
react-avatar
Avatar
45.605 kB
13.326 kB
45.588 kB
13.32 kB
-17 B
-6 B
react-badge
Badge
21.002 kB
6.628 kB
20.985 kB
6.62 kB
-17 B
-8 B
react-badge
CounterBadge
21.915 kB
6.933 kB
21.898 kB
6.925 kB
-17 B
-8 B
react-badge
PresenceBadge
22.227 kB
6.679 kB
22.21 kB
6.672 kB
-17 B
-7 B
Unchanged fixtures
Package & Exports Size (minified/GZIP)
react-components
react-components: Accordion, Button, FluentProvider, Image, Menu, Popover
181.379 kB
50.656 kB
react-components
react-components: FluentProvider & webLightTheme
34.078 kB
11.098 kB
🤖 This report was generated against 5ed22515a7542b432ed694f22606ac3718d501cb

@size-auditor
Copy link

size-auditor bot commented May 5, 2022

Asset size changes

Size Auditor did not detect a change in bundle size for any component!

Baseline commit: 5ed22515a7542b432ed694f22606ac3718d501cb (build)

```jsx
<button>
Inbox
<Badge>6<span class="visuallyHidden"> unread messages</span></Badge>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

during Badge design review it was agreed to put additional information to the description, can you please elaborate on reasons for changing the recommendation?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe something changed so it can be worth re-testing but I remember bugs where hidden texts were causing issues with voice control / dictation - as the voice control software required to read the whole label in order to navigate to the element. Hiding works very well for screen readers, but it might not be the case for all scenarios :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did a quick test:

<html>

<head>
  <style>
    .visually-hidden {
      clip: rect(0 0 0 0);
      clip-path: inset(50%);
      height: 1px;
      overflow: hidden;
      position: absolute;
      white-space: nowrap;
      width: 1px;
    }
  </style>
</head>

<body>
  <button>Batman</button>
  <button>Strawberry <span class="visually-hidden">superhero</span></button>
</body>

I can use Voice Control to click on Batman, but Strawberry is not being recognized.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jurokapsiar which voice control software are you using? Partial labels have not been a problem in the past, at least with the voice control software I'm familiar with. If it is now, that seems like a major issue for a lot of common approaches to accessible text, and probably something we should follow up on as a bug with the software itself.

The issue with putting badge info as a description mostly falls into two categories:

  1. The description needs to go on something that accepts an accessible name/description. It's worth noting that this did not happen in a number of our existing examples, meaning the description was effectively worthless.
  2. A description is much less likely to be read, since it depends heavily on the user having their verbosity relatively high (or specifically turning on descriptions). Generally the accessible description should be used for information that is fully optional/unnecessary for the user to receive. Sometimes badges will fall into this category, hence the best practices text on how to mark those up. I just don't think it should be our default.

The first issue is the much more serious one. Based on the variety of places a badge can be used, the only real safe way to default to exposing the text is to have it show up as actual content.

},
root: getNativeElementProps('div', {
ref,
'aria-hidden': true,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the impact of this change for Avatar? That is a role='img' with now a text inside of it. It would be good to test with screen readers and see if we need to give some best practices for Avatar usage.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Avatar currently has aria-labelledby pointing to both itself and the badge, which right now has aria-hidden. Where that currently works, we're relying on behavior quirks. It'd be better to remove the aria-hidden so the accname for the image is built from non-hidden content.

@fabricteam
Copy link
Collaborator

fabricteam commented May 9, 2022

Perf Analysis (@fluentui/react-components)

No significant results to display.

All results

Scenario Render type Master Ticks PR Ticks Iterations Status
Avatar mount 1267 1204 5000
Button mount 739 753 5000
FluentProvider mount 2124 2154 5000
FluentProviderWithTheme mount 352 385 10
FluentProviderWithTheme virtual-rerender 336 344 10
FluentProviderWithTheme virtual-rerender-with-unmount 420 460 10
MakeStyles mount 1889 2034 50000

@smhigley smhigley merged commit 7c773e3 into microsoft:master May 23, 2022
marwan38 pushed a commit to marwan38/fluentui that referenced this pull request Jun 13, 2022
 remove aria-hidden from badge, and add docs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants